Fixed #481 and more