Fixes the behaviour of hittest()