applied minor fixes to commit 56e1f4ed8a8486ad951a6af087475e69f03f45b7