Added proper handling of post messages