avoiding bug where alpha value goes out of range (don't know what causes this)