bugfix credits to mr layout