fixed few bugs thanks to defiant07