constants replacement and bugfix