remove new_from_px, fix some code