Fix bugs

thanks to albel727^^