Revert "Fixed #540"

This reverts commit 4bbe7e1f3013399217ac1f561c45151692073498.
Fixed #540, fixed #543