minor bugfixes
prepared for npm