Fixed collision issue, included all changes from 4785a805d6