Declare sign operators for physical types
Fix some array index checking bugs