Fixed some logical errors
Merge branch 'master' of github.com:muesli/beehive
Refactoring
Do the fix in 75eebd177dcc92c63831ad9aaf88e7217a1ac118 correctly.
Merge branch 'master' of github.com:muesli/beehive