Fix bugs with `toPx()` function