Bugfix for condition and code style issues