Fixed issues #71, #76, #75 and #77