fixed two bugs, thx to GrieferAtWork