buffer lock
{} added in if's
only one return in a funktion