Fixed issues according to Alexander's comment number 2