Created by: sidoshi
this solves issue #1042 But in order for this changes to work this PR needs to be accepted.