Bug fixes

Huge thanks to the contributors: @alotbsol555 @FlippingBinary
