Fix wrong type bug in implicit coercions