Bug/various fixes